package com.example.shop.mapper;

import com.example.shop.entity.Shop;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author qwert
 * @version 1.0.0
 * @create 2025/9/2 21:42
 **/
@Mapper
public interface ShopMapper {

    @Insert("""
INSERT INTO mi_shop (shop_id, shop_name, cover_image_id, create_time, update_time, operator_id, is_delete)
 VALUES (#{shopId}, #{shopName}, #{coverImageId}, now(), now(), null, 0);
""")
    void addShop(Shop shop);

    @Select("""
select * from mi_shop where shop_id = #{shopId}
""")
    Shop queryShopById(String shopId);

    @Select("""
<script>
SELECT * FROM mi_shop
WHERE shop_id IN
      <foreach collection="shopIds" item="shopId" open="(" close=")" separator=",">
          #{shopId}
      </foreach>
</script>
""")
    List<Shop> queryShopListById(List<String> shopIds);
@Select("""
select * from mi_shop
""")
    List<Shop> queryShopList();
}
